package com.heima.wemedia.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.AdminNewsPageReqDto;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.model.wemedia.dtos.WmNewsPageReqDto;
import com.heima.wemedia.service.WmNewsService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2023/3/16 11:08
 * @Version 1.0
 */
@RestController
public class WmNewsController {

    @Autowired
    private WmNewsService wmNewsService;

    @PostMapping("/api/v1/news/list")
    public ResponseResult list(@RequestBody WmNewsPageReqDto reqDto){

        return wmNewsService.pageList(reqDto);
    }
    @PostMapping("/api/v1/news/submit")
    public ResponseResult submit(@RequestBody WmNewsDto newsDto){
        return wmNewsService.submit(newsDto);
    }

    @ApiOperation("查询文章列表")
    @PostMapping("/api/v1/news/list_vo")
    public ResponseResult list_vo(@RequestBody AdminNewsPageReqDto dto){
        return wmNewsService.list_vo(dto);
    }

    @ApiOperation("查看文章详情")
    @GetMapping("/api/v1/news/one_vo/{id}")
    public ResponseResult one_vo(@PathVariable("id") Integer id){
        return wmNewsService.one_vo(id);
    }

    @ApiOperation("审核失败")
    @PostMapping("/api/v1/news/auth_fail")
    public ResponseResult auth_fail(@RequestBody AdminNewsPageReqDto newsDto){
        return wmNewsService.auth_fail(newsDto);
    }

    @ApiOperation("审核通过")
    @PostMapping("/news/auth_pass")
    public ResponseResult auth_pass(@RequestBody AdminNewsPageReqDto newsDto){
        return wmNewsService.auth_pass(newsDto);
    }



}